// PageConn.cpp : implementation file
//

#include "stdafx.h"
#include "greenftp.h"
#include "PageConn.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CPageConn property page

IMPLEMENT_DYNCREATE(CPageConn, CPropertyPage)

CPageConn::CPageConn() : CPropertyPage(CPageConn::IDD)
{
	//{{AFX_DATA_INIT(CPageConn)
	m_iCacheDays = m_pFtpConfig->m_iCacheDays;
	m_iRetries =m_pFtpConfig->m_iRetries;
	m_iRetryDelay = m_pFtpConfig->m_iRetryDelay;
	m_iTimeOut =m_pFtpConfig->m_iTimeOut;
	m_iTransferMax = m_pFtpConfig->m_iTransferMax;
	m_iDownSpdLimit =m_pFtpConfig->m_iDownSpdLimit;
	m_iUpSpdLimit =m_pFtpConfig->m_iUpSpdLimit;
	m_PASV = m_pFtpConfig->m_PASV;
	//}}AFX_DATA_INIT
}

CPageConn::~CPageConn()
{
}

void CPageConn::DoDataExchange(CDataExchange* pDX)
{
	CPropertyPage::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CPageConn)
	DDX_Control(pDX, IDC_SPIN_UPLIMIT, m_spinUpLimit);
	DDX_Control(pDX, IDC_SPIN_TRANS_MAX, m_spinTransMax);
	DDX_Control(pDX, IDC_SPIN_TIMEOUT, m_spinTimeOut);
	DDX_Control(pDX, IDC_SPIN_RETRYDELAY, m_spinRertyDelay);
	DDX_Control(pDX, IDC_SPIN_RETRIES, m_spinRetries);
	DDX_Control(pDX, IDC_SPIN_DOWNLIMIT, m_spinDownLimit);
	DDX_Control(pDX, IDC_SPIN_CACHE_DAYS, m_spinCacheDays);
	DDX_Text(pDX, IDC_CACHE_KEEPDAYS, m_iCacheDays);
	DDX_Text(pDX, IDC_DOWNLIMIT, m_iDownSpdLimit);
	DDX_Text(pDX, IDC_RETRIES, m_iRetries);
	DDX_Text(pDX, IDC_RETRYDELAY, m_iRetryDelay);
	DDX_Text(pDX, IDC_TIMEOUT, m_iTimeOut);
	DDX_Text(pDX, IDC_TRANSFER_MAX, m_iTransferMax);
	DDX_Text(pDX, IDC_UPLIMIT, m_iUpSpdLimit);
	DDX_Check(pDX, IDC_USE_PASVMODE, m_PASV);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CPageConn, CPropertyPage)
	//{{AFX_MSG_MAP(CPageConn)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CPageConn message handlers

BOOL CPageConn::OnInitDialog() 
{
	CPropertyPage::OnInitDialog();
	
	// TODO: Add extra initialization here
	m_spinCacheDays.SetRange(0,10);
	m_spinCacheDays.SetBuddy(GetDlgItem(IDC_CACHE_KEEPDAYS));
	m_spinDownLimit.SetRange(0,256);
	m_spinDownLimit.SetBuddy(GetDlgItem(IDC_DOWNLIMIT));
	m_spinRetries.SetRange(1,10);
	m_spinRetries.SetBuddy(GetDlgItem(IDC_RETRIES));
	m_spinRertyDelay.SetRange(1,360);
	m_spinRertyDelay.SetBuddy(GetDlgItem(IDC_RETRYDELAY));
	m_spinTimeOut.SetRange(10,60);
	m_spinTimeOut.SetBuddy(GetDlgItem(IDC_TIMEOUT));
	m_spinTransMax.SetRange(1,1);
	m_spinTransMax.SetBuddy(GetDlgItem(IDC_TRANSFER_MAX));
	m_spinUpLimit.SetRange(0,256);
	m_spinUpLimit.SetBuddy(GetDlgItem(IDC_UPLIMIT));
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
